Skip to content

add TypeScript defintions#16

Merged
stoecker merged 1 commit into
JOSM:masterfrom
k-yle:kh/types
Jul 1, 2025
Merged

add TypeScript defintions#16
stoecker merged 1 commit into
JOSM:masterfrom
k-yle:kh/types

Conversation

@k-yle
Copy link
Copy Markdown
Contributor

@k-yle k-yle commented Jul 1, 2025

This helpful for anyone importing the npm package from JavaScript or TypeScript.

Even people who don't use type-checking with still benefit, because IDEs will use these defintions to provide auto-complete suggestions. For example:

image

@stoecker
Copy link
Copy Markdown
Collaborator

stoecker commented Jul 1, 2025

If I see this correctly you only allow two values for source. That's wrong.

@k-yle
Copy link
Copy Markdown
Contributor Author

k-yle commented Jul 1, 2025

@stoecker I see, would you suggest a generic defintion like this:

source: `${'wikidata' | 'osm'}:P${number}`

or explicitly listing every value which is currently hardcoded in this repository:

source: `wikidata:P${1630 | 3303}` | `osmwiki:P8`

@stoecker
Copy link
Copy Markdown
Collaborator

stoecker commented Jul 1, 2025

The first looks better to me.

@k-yle
Copy link
Copy Markdown
Contributor Author

k-yle commented Jul 1, 2025

cool, updated

@stoecker stoecker merged commit eda9646 into JOSM:master Jul 1, 2025
1 check failed
@k-yle k-yle deleted the kh/types branch July 1, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants